#ifndef APNAVTREEMODEL_H
#define APNAVTREEMODEL_H

#include <QAbstractItemModel>
#include "housingdbms.h"

#define IN_STREETS  0
#define IN_HOUSES   1

class HousingDBMS;

class ApNavTreeModel : public QAbstractItemModel
{
    Q_OBJECT
    HousingDBMS *mp_dbms;
    QVariantList mqvl_str_indexes;
    QList<QVariantList > mqvl_hs_indexes_lst;
public:
    explicit ApNavTreeModel(QObject *parent = 0);
     void set_dbms(HousingDBMS *p_dbms) ;
    QModelIndex index(int row, int column, const QModelIndex &parent) const;
    QModelIndex parent(const QModelIndex &child) const;
    int rowCount(const QModelIndex &parent) const;
    int columnCount(const QModelIndex &parent) const;
    QVariant data(const QModelIndex &index, int role) const;
    int get_nav_type(const QModelIndex &index);
    QVariant get_db_index(const QModelIndex &index);
    QModelIndex createIndexFor(int type, const QVariant &qv_key);
    QVariantList get_h_indexes();
    QVariant get_h_index(const QModelIndex &index);
    inline void changes_notify(const QModelIndex &index) { emit dataChanged(index, index);}

signals:

public slots:
    void load_data();
};

#endif // APNAVTREEMODEL_H
